﻿Imports Alquilaqi
Public Class EliminarInmueble
    Public inmuebleForm As InmuebleMain
    Private Sub InmuebleEliminar_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Buscarbt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buscarbt.Click
        Dim criterio As String = Me.buscarT.Text
        'MsgBox(criterio)

        Dim negocio As New InmuebleNegocio
        Dim inmueble As Collection = negocio.buscarPorNombre(criterio)
        Me.dginmueble.DataSource = inmueble
        Me.dginmueble.EditMode = False
        If inmueble.Count > 0 Then

            Me.dginmueble.Columns(0).HeaderText = "Id"
            Me.dginmueble.Columns(1).Visible = False
            Me.dginmueble.Columns(2).Visible = False
            Me.dginmueble.Columns(3).Visible = False
            Me.dginmueble.Columns(4).HeaderText = "Precio"
            Me.dginmueble.Columns(5).Visible = False
            Me.dginmueble.Columns(6).Visible = False
            Me.dginmueble.Columns(7).Visible = False
            Me.dginmueble.Columns(8).HeaderText = "Foto1"
            Me.dginmueble.Columns(9).HeaderText = "Foto2"
            Me.dginmueble.Columns(10).HeaderText = "Estado"
            Me.dginmueble.Columns(11).Visible = False
            Me.dginmueble.Columns(12).HeaderText = "Valoración"

        End If
        With Me.dginmueble.ColumnHeadersDefaultCellStyle
            .BackColor = Color.Red
            .ForeColor = Color.White
        End With



    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim seleccionado = Me.dginmueble.CurrentRow.Cells(0).Value.ToString
        Dim negocio As New InmuebleNegocio
        negocio.eliminar(seleccionado)
        dginmueble.DataSource = ""
    End Sub
End Class